Optimal. Leaf size=55 \[ -\frac {\tanh ^{-1}(\cos (c+d x))}{a d}+\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \cos (c+d x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b} d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.04, antiderivative size = 55, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {3265, 400, 212,
214} \begin {gather*} \frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \cos (c+d x)}{\sqrt {a+b}}\right )}{a d \sqrt {a+b}}-\frac {\tanh ^{-1}(\cos (c+d x))}{a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 214
Rule 400
Rule 3265
Rubi steps
\begin {align*} \int \frac {\csc (c+d x)}{a+b \sin ^2(c+d x)} \, dx &=-\frac {\text {Subst}\left (\int \frac {1}{\left (1-x^2\right ) \left (a+b-b x^2\right )} \, dx,x,\cos (c+d x)\right )}{d}\\ &=-\frac {\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\cos (c+d x)\right )}{a d}+\frac {b \text {Subst}\left (\int \frac {1}{a+b-b x^2} \, dx,x,\cos (c+d x)\right )}{a d}\\ &=-\frac {\tanh ^{-1}(\cos (c+d x))}{a d}+\frac {\sqrt {b} \tanh ^{-1}\left (\frac {\sqrt {b} \cos (c+d x)}{\sqrt {a+b}}\right )}{a \sqrt {a+b} d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.19, size = 143, normalized size = 2.60 \begin {gather*} -\frac {\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b}-i \sqrt {a} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a-b}}\right )}{\sqrt {-a-b}}+\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b}+i \sqrt {a} \tan \left (\frac {1}{2} (c+d x)\right )}{\sqrt {-a-b}}\right )}{\sqrt {-a-b}}+\log \left (\cos \left (\frac {1}{2} (c+d x)\right )\right )-\log \left (\sin \left (\frac {1}{2} (c+d x)\right )\right )}{a d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.28, size = 62, normalized size = 1.13
method | result | size |
derivativedivides | \(\frac {\frac {b \arctanh \left (\frac {b \cos \left (d x +c \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a \sqrt {\left (a +b \right ) b}}+\frac {\ln \left (\cos \left (d x +c \right )-1\right )}{2 a}-\frac {\ln \left (1+\cos \left (d x +c \right )\right )}{2 a}}{d}\) | \(62\) |
default | \(\frac {\frac {b \arctanh \left (\frac {b \cos \left (d x +c \right )}{\sqrt {\left (a +b \right ) b}}\right )}{a \sqrt {\left (a +b \right ) b}}+\frac {\ln \left (\cos \left (d x +c \right )-1\right )}{2 a}-\frac {\ln \left (1+\cos \left (d x +c \right )\right )}{2 a}}{d}\) | \(62\) |
risch | \(\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-1\right )}{a d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+1\right )}{a d}+\frac {i \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+\frac {2 i \sqrt {-\left (a +b \right ) b}\, {\mathrm e}^{i \left (d x +c \right )}}{b}+1\right )}{2 \left (a +b \right ) d a}-\frac {i \sqrt {-\left (a +b \right ) b}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {2 i \sqrt {-\left (a +b \right ) b}\, {\mathrm e}^{i \left (d x +c \right )}}{b}+1\right )}{2 \left (a +b \right ) d a}\) | \(155\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.55, size = 83, normalized size = 1.51 \begin {gather*} -\frac {\frac {b \log \left (\frac {b \cos \left (d x + c\right ) - \sqrt {{\left (a + b\right )} b}}{b \cos \left (d x + c\right ) + \sqrt {{\left (a + b\right )} b}}\right )}{\sqrt {{\left (a + b\right )} b} a} + \frac {\log \left (\cos \left (d x + c\right ) + 1\right )}{a} - \frac {\log \left (\cos \left (d x + c\right ) - 1\right )}{a}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.42, size = 161, normalized size = 2.93 \begin {gather*} \left [\frac {\sqrt {\frac {b}{a + b}} \log \left (\frac {b \cos \left (d x + c\right )^{2} + 2 \, {\left (a + b\right )} \sqrt {\frac {b}{a + b}} \cos \left (d x + c\right ) + a + b}{b \cos \left (d x + c\right )^{2} - a - b}\right ) - \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) + \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, a d}, -\frac {2 \, \sqrt {-\frac {b}{a + b}} \arctan \left (\sqrt {-\frac {b}{a + b}} \cos \left (d x + c\right )\right ) + \log \left (\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right ) - \log \left (-\frac {1}{2} \, \cos \left (d x + c\right ) + \frac {1}{2}\right )}{2 \, a d}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\csc {\left (c + d x \right )}}{a + b \sin ^{2}{\left (c + d x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 100 vs.
\(2 (47) = 94\).
time = 0.55, size = 100, normalized size = 1.82 \begin {gather*} -\frac {\frac {2 \, b \arctan \left (\frac {b \cos \left (d x + c\right ) + a + b}{\sqrt {-a b - b^{2}} \cos \left (d x + c\right ) + \sqrt {-a b - b^{2}}}\right )}{\sqrt {-a b - b^{2}} a} - \frac {\log \left (\frac {{\left | -\cos \left (d x + c\right ) + 1 \right |}}{{\left | \cos \left (d x + c\right ) + 1 \right |}}\right )}{a}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 13.73, size = 457, normalized size = 8.31 \begin {gather*} -\frac {\mathrm {atanh}\left (\cos \left (c+d\,x\right )\right )}{a\,d}-\frac {\mathrm {atan}\left (\frac {\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )+\frac {\left (2\,a^2\,b^2-\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{a^2+b\,a}+\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )-\frac {\left (2\,a^2\,b^2+\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{a^2+b\,a}}{\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )+\frac {\left (2\,a^2\,b^2-\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{a^2+b\,a}-\frac {\left (2\,b^3\,\cos \left (c+d\,x\right )-\frac {\left (2\,a^2\,b^2+\frac {\cos \left (c+d\,x\right )\,\left (8\,a^3\,b^2+16\,a^2\,b^3\right )\,\sqrt {b\,\left (a+b\right )}}{4\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {b\,\left (a+b\right )}}{a^2+b\,a}}\right )\,\sqrt {b\,\left (a+b\right )}\,1{}\mathrm {i}}{d\,\left (a^2+b\,a\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________